<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>京东-欢迎登陆</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/login.css">
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_2762009_zeifj9yf9jh.css">
    <script src="https://at.alicdn.com/t/font_2762009_atpforo7duc.js"></script>
</head>
<style type="text/css">
    .icon {
       width: 1em; height: 1em;
       vertical-align: -0.15em;
       fill: currentColor;
       overflow: hidden;
    }
</style>
<body>
    <!-- 头部 start -->
    <div class="w">
        <div id="logo">
            <a href="#">
                <img src="./images/logo.png">
            </a>
            <b></b>
        </div>
        <a href="https://wj-dongjian.jd.com/q/61a05143f2ec2b00b35e40a6" class="question">
            <b></b>
            登录页面，调查问卷
        </a>
    </div>
    <!-- 头部 end -->
    <!-- 主体登录部分 start-->
    <div id="content">
        <!-- 浅黄色提示部分 start -->
        <div class="jd_tips">
            <div class="jd_intips">
                <p>依据《网络安全法》，为保障您的账户安全和正常使用，请尽快完成手机号验证！ 新版《京东隐私政策》已上线，将更有利于保护您的个人隐私。</p>
            </div>
        </div>
        <!-- 浅黄色提示部分 end -->
        <div class="login">
            <div class="w">
                <div class="bg">
                      <div class="tips_wrapper">
                        <p>京东不会以任何理由要求您转账汇款，谨防诈骗。</p>
                    </div>
                <div class="login_form">
                        <div class="login_tab">
                            <a>账号登陆</a>
                            <p style="color: #f4f4f4">|</p>
                            <div>
                                <a>手机动态码登录<i class="iconfont icon-shouji"></i></a>
                                <a></a>
                            </div>
                        </div>
                        <span class="warning"></span>
                        <div class="login_text">
                            <input type="text" placeholder=" 用户名 / 登录手机" class="text">
                        </div>
                        <div class="login_pwd">
                            <!-- <i class="iconfont icon-suo" style="color: gray;"></i> -->
                            <input type="password" placeholder=" 密码" class="pwd">
                        </div>
                        <div class="forget_pwd">
                            <a style="color: #666666;">忘记密码？</a>
                        </div>
                        <div class="btn_login">
                            <button class="btn">登 录</button>
                        </div>
                        <div class="other_login">
                            <a class="qq"> 
                            <svg class="icon" style="width: 27px " aria-hidden="true">
                                <use xlink:href="#icon-QQfang"></use>
                            </svg><sapn>QQ</span>
                            <span> | </span>
                            </a>
                            <a class="wechat">
                            <svg class="icon" aria-hidden="true">
                                <use xlink:href="#icon-yulunchang-xinlangweibo"></use>
                            </svg>
                            <span>微信</span>
                            </a>
                            <a href="register.html" class="right_register">>立即注册</a>
                        </div>
                </div>
            </div>
            </div>
        </div>
    </div>
    <!-- 主体登录部分 end -->
    <!-- 底部版权部分 start -->
    <div class="bottom">
        <footer class="footer">
            <!-- 版权模块 -->
            <div class="mod_copyright w">
                <div class="links">
                <div class="links1"><a href="#">关于我们</a></div>
                <div class="links1"><a href="#">联系我们</a></div>
                <div class="links1"><a href="#">联系客服</a></div>
                <div class="links1"><a href="#">合作招聘</a></div>
                <div class="links1"><a href="#">商家帮助</a></div>
                <div class="links1"><a href="#">营销中心</a></div>
                <div class="links1"><a href="#">手机京东</a></div>
                <div class="links1"><a href="#">友情链接</a></div>
                <div class="links1"><a href="#">销售联盟</a></div>
                <div class="links1"><a href="#">京东社区</a></div>
                <div class="links1"><a href="#">风险监测</a></div>
                <div class="links1"><a href="#">隐私政策</a></div>
                <div class="links1"><a href="#">京东公益</a></div>
                <div><a href="#">English Site</a></div>
                </div>
                <div class="copyright">
                    <a href="">京公网安备 1100000200008号</a> | <a href="">京ICP备11041704号</a> | <a href="">互联网药品信息服务资格证编号(京)-经营性-2014-0008</a> | <a href="">新出发京零 字第大120007号</a><br><a href="">互联网出版许可证编号新出网证(京)字150号</a> | <a href="">出版物经营许可证</a> | <a href="">网络文化经营许可经文网[2020]6112-1201号</a> | <a href="">违法和不良信息举报电话：4006561155</a><br><a href="">Copyright 2004 - 2022 京东JD.com 版权所有</a> | <a href="">消费者维权热线：4006067733</a> | <a href="">经营执照：网线平台备字(2018)第00003号</a><br><a href="">京东旗下网站：京东钱包</a> | <a href="">京东云</a> | <a href="">网络内容从业人员违法违规行为举报电话：4006561155-3</a>
                </div>
            </div>
            </footer></div>
    <!-- 底部版权部分 end -->
    <script>
        let text=document.querySelector('.text')
        let pwd=document.querySelector('.pwd')
        let btn=document.querySelector('.btn')
        let err=document.querySelector('.warning')
        btn.addEventListener('click',function(){
            localStorage.setItem('username',text.value);
            localStorage.setItem('password',pwd.value);
            const xhr=new XMLHttpRequest();
            xhr.open('POST','http://139.155.69.249:8081/v1/user/login');
            xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
            xhr.setRequestHeader('Origin','http://39.144.218.38');
            xhr.send('username='+text.value+'&password='+pwd.value+'');
            xhr.onreadystatechange=function(){
                if(xhr.readyState===4){
                    if(xhr.status>=200&&xhr.status<300){
                        let str=xhr.response;
                        obj=JSON.parse(xhr.response);
                        localStorage.setItem('token',obj.token);
                        localStorage.setItem('user_id',obj.uid);
                        console.log(obj.token);
                        if(str.includes('成功')){
                            
                            window.location.href="login_sucess.html";
                        }
                        else{
                            console.log(typeof(JSON.parse(xhr.response)));
                        err.style.display='block';
                        console.log(obj.data);
                        err.innerHTML=obj.data;
                        }
                       
                    }
                }
            }
            })
    </script>
</body>
</html>